﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.Content;
using Android.Util;

namespace GBU.Services.Common
{
    public delegate void OnCommReceiveBroadcastDelegate(StrBroadcastEventArgs args);

    public class StrBroadcastReceiver : BroadcastReceiver
    {
        public event OnCommReceiveBroadcastDelegate OnReceiveBroadcast;

        public override void OnReceive(Context context, Intent intent)
        {
            var result = intent.Extras.GetString(MessageType.GpsPointKey);
            //Log.Debug("CommReceiver", "Receiving data action: " + intent.Action);
            //Log.Debug("CommReceiver", "Receiving data  " + result);
            if (OnReceiveBroadcast != null)
            {
                OnReceiveBroadcast(new StrBroadcastEventArgs() { ReceiveMessageType = intent.Action, ReceiveData = result });
            }
        }
    }
}
